API: Remove the ability to set the dnd icon from a pixmap
authorBenjamin Otte <otte@redhat.com>
Wed, 25 Aug 2010 14:49:45 +0000 (16:49 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 26 Sep 2010 13:11:11 +0000 (15:11 +0200)
gtk/gtk.symbols
gtk/gtkdnd-quartz.c
gtk/gtkdnd.c
gtk/gtkdnd.h

index f11e3fd0350b9488c4ff09b8ce295310f5faf6ea..66dcab3fb272b97adc9129778965a1960b2417ab 100644 (file)
@@ -947,7 +947,6 @@ gtk_drag_highlight
 gtk_drag_set_icon_default
 gtk_drag_set_icon_name
 gtk_drag_set_icon_pixbuf
-gtk_drag_set_icon_pixmap
 gtk_drag_set_icon_stock
 gtk_drag_set_icon_surface
 gtk_drag_set_icon_widget
@@ -956,7 +955,6 @@ gtk_drag_source_add_text_targets
 gtk_drag_source_add_uri_targets
 gtk_drag_source_get_target_list
 gtk_drag_source_set
-gtk_drag_source_set_icon
 gtk_drag_source_set_icon_name
 gtk_drag_source_set_icon_pixbuf
 gtk_drag_source_set_icon_stock
index 3b4ddb652943784072667f2b68f9cab5cdc5cee2..3d40f163d0c2da5634fdb95d2b488f2d340a06d7 100644 (file)
@@ -77,14 +77,10 @@ struct _GtkDragSourceSite
   GtkImageType icon_type;
   union
   {
-    GtkImagePixmapData pixmap;
     GtkImagePixbufData pixbuf;
     GtkImageStockData stock;
     GtkImageIconNameData name;
   } icon_data;
-  GdkBitmap *icon_mask;
-
-  GdkColormap       *colormap;          /* Colormap for drag icon */
 
   /* Stored button press information to detect drag beginning */
   gint               state;
@@ -1161,30 +1157,6 @@ gtk_drag_begin_internal (GtkWidget         *widget,
       else
        switch (site->icon_type)
          {
-         case GTK_IMAGE_PIXMAP:
-           /* This is not supported, so just set a small transparent pixbuf
-            * since we need to have something.
-            */
-           if (0)
-             gtk_drag_set_icon_pixmap (context,
-                                       site->colormap,
-                                       site->icon_data.pixmap.pixmap,
-                                       site->icon_mask,
-                                       -2, -2);
-           else
-             {
-               GdkPixbuf *pixbuf;
-
-               pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 1, 1);
-               gdk_pixbuf_fill (pixbuf, 0xffffff);
-
-               gtk_drag_set_icon_pixbuf (context,
-                                         pixbuf,
-                                         0, 0);
-
-               g_object_unref (pixbuf);
-             }
-           break;
          case GTK_IMAGE_PIXBUF:
            gtk_drag_set_icon_pixbuf (context,
                                      site->icon_data.pixbuf.pixbuf,
@@ -1474,12 +1446,6 @@ gtk_drag_source_unset_icon (GtkDragSourceSite *site)
     {
     case GTK_IMAGE_EMPTY:
       break;
-    case GTK_IMAGE_PIXMAP:
-      if (site->icon_data.pixmap.pixmap)
-       g_object_unref (site->icon_data.pixmap.pixmap);
-      if (site->icon_mask)
-       g_object_unref (site->icon_mask);
-      break;
     case GTK_IMAGE_PIXBUF:
       g_object_unref (site->icon_data.pixbuf.pixbuf);
       break;
@@ -1494,10 +1460,6 @@ gtk_drag_source_unset_icon (GtkDragSourceSite *site)
       break;
     }
   site->icon_type = GTK_IMAGE_EMPTY;
-  
-  if (site->colormap)
-    g_object_unref (site->colormap);
-  site->colormap = NULL;
 }
 
 static void 
@@ -1512,36 +1474,6 @@ gtk_drag_source_site_destroy (gpointer data)
   g_free (site);
 }
 
-void 
-gtk_drag_source_set_icon (GtkWidget     *widget,
-                         GdkColormap   *colormap,
-                         GdkPixmap     *pixmap,
-                         GdkBitmap     *mask)
-{
-  GtkDragSourceSite *site;
-
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (GDK_IS_COLORMAP (colormap));
-  g_return_if_fail (GDK_IS_PIXMAP (pixmap));
-  g_return_if_fail (!mask || GDK_IS_PIXMAP (mask));
-
-  site = g_object_get_data (G_OBJECT (widget), "gtk-site-data");
-  g_return_if_fail (site != NULL);
-  
-  g_object_ref (colormap);
-  g_object_ref (pixmap);
-  if (mask)
-    g_object_ref (mask);
-
-  gtk_drag_source_unset_icon (site);
-
-  site->icon_type = GTK_IMAGE_PIXMAP;
-  
-  site->icon_data.pixmap.pixmap = pixmap;
-  site->icon_mask = mask;
-  site->colormap = colormap;
-}
-
 void 
 gtk_drag_source_set_icon_pixbuf (GtkWidget   *widget,
                                 GdkPixbuf   *pixbuf)
@@ -1721,45 +1653,6 @@ gtk_drag_set_icon_stock  (GdkDragContext *context,
   set_icon_stock_pixbuf (context, stock_id, NULL, hot_x, hot_y);
 }
 
-/**
- * gtk_drag_set_icon_pixmap:
- * @context: the context for a drag. (This must be called 
- *            with a  context for the source side of a drag)
- * @colormap: the colormap of the icon 
- * @pixmap: the image data for the icon 
- * @mask: the transparency mask for the icon
- * @hot_x: the X offset within @pixmap of the hotspot.
- * @hot_y: the Y offset within @pixmap of the hotspot.
- * 
- * Sets @pixmap as the icon for a given drag. GTK+ retains
- * references for the arguments, and will release them when
- * they are no longer needed. In general, gtk_drag_set_icon_pixbuf()
- * will be more convenient to use.
- **/
-void 
-gtk_drag_set_icon_pixmap (GdkDragContext    *context,
-                         GdkColormap       *colormap,
-                         GdkPixmap         *pixmap,
-                         GdkBitmap         *mask,
-                         gint               hot_x,
-                         gint               hot_y)
-{
-  GdkPixbuf *pixbuf;
-
-  g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
-  g_return_if_fail (context->is_source);
-  g_return_if_fail (GDK_IS_COLORMAP (colormap));
-  g_return_if_fail (GDK_IS_PIXMAP (pixmap));
-
-  pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, colormap,
-                                         0, 0, /* src */
-                                         0, 0, /* dst */
-                                         -1, -1);
-
-  gtk_drag_set_icon_pixbuf (context, pixbuf, hot_x, hot_y);
-  g_object_unref (pixbuf);
-}
-
 /**
  * gtk_drag_set_icon_name:
  * @context: the context for a drag. (This must be called 
index 8448a7a69198ea4d3d2552937a1fc2f9e78599ec..79c48063eb3ea70509c0d0633867e61a99b9d728 100644 (file)
@@ -79,12 +79,10 @@ struct _GtkDragSourceSite
   GtkImageType icon_type;
   union
   {
-    GtkImagePixmapData pixmap;
     GtkImagePixbufData pixbuf;
     GtkImageStockData stock;
     GtkImageIconNameData name;
   } icon_data;
-  GdkBitmap *icon_mask;
 
   GdkColormap       *colormap;          /* Colormap for drag icon */
 
@@ -2466,13 +2464,6 @@ gtk_drag_begin_internal (GtkWidget         *widget,
       else
        switch (site->icon_type)
          {
-         case GTK_IMAGE_PIXMAP:
-           gtk_drag_set_icon_pixmap (context,
-                                     site->colormap,
-                                     site->icon_data.pixmap.pixmap,
-                                     site->icon_mask,
-                                     -2, -2);
-           break;
          case GTK_IMAGE_PIXBUF:
            gtk_drag_set_icon_pixbuf (context,
                                      site->icon_data.pixbuf.pixbuf,
@@ -2834,12 +2825,6 @@ gtk_drag_source_unset_icon (GtkDragSourceSite *site)
     {
     case GTK_IMAGE_EMPTY:
       break;
-    case GTK_IMAGE_PIXMAP:
-      if (site->icon_data.pixmap.pixmap)
-       g_object_unref (site->icon_data.pixmap.pixmap);
-      if (site->icon_mask)
-       g_object_unref (site->icon_mask);
-      break;
     case GTK_IMAGE_PIXBUF:
       g_object_unref (site->icon_data.pixbuf.pixbuf);
       break;
@@ -2860,48 +2845,6 @@ gtk_drag_source_unset_icon (GtkDragSourceSite *site)
   site->colormap = NULL;
 }
 
-/**
- * gtk_drag_source_set_icon:
- * @widget: a #GtkWidget
- * @colormap: the colormap of the icon
- * @pixmap: the image data for the icon
- * @mask: (allow-none): the transparency mask for an image.
- *
- * Sets the icon that will be used for drags from a particular widget
- * from a pixmap/mask. GTK+ retains references for the arguments, and
- * will release them when they are no longer needed.
- * Use gtk_drag_source_set_icon_pixbuf() instead.
- **/
-void 
-gtk_drag_source_set_icon (GtkWidget     *widget,
-                         GdkColormap   *colormap,
-                         GdkPixmap     *pixmap,
-                         GdkBitmap     *mask)
-{
-  GtkDragSourceSite *site;
-
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (GDK_IS_COLORMAP (colormap));
-  g_return_if_fail (GDK_IS_PIXMAP (pixmap));
-  g_return_if_fail (!mask || GDK_IS_PIXMAP (mask));
-
-  site = g_object_get_data (G_OBJECT (widget), "gtk-site-data");
-  g_return_if_fail (site != NULL);
-  
-  g_object_ref (colormap);
-  g_object_ref (pixmap);
-  if (mask)
-    g_object_ref (mask);
-
-  gtk_drag_source_unset_icon (site);
-
-  site->icon_type = GTK_IMAGE_PIXMAP;
-  
-  site->icon_data.pixmap.pixmap = pixmap;
-  site->icon_mask = mask;
-  site->colormap = colormap;
-}
-
 /**
  * gtk_drag_source_set_icon_pixbuf:
  * @widget: a #GtkWidget
@@ -3278,80 +3221,6 @@ gtk_drag_set_icon_stock  (GdkDragContext *context,
   set_icon_stock_pixbuf (context, stock_id, NULL, hot_x, hot_y, FALSE);
 }
 
-/**
- * gtk_drag_set_icon_pixmap:
- * @context: the context for a drag. (This must be called 
- *            with a  context for the source side of a drag)
- * @colormap: the colormap of the icon 
- * @pixmap: the image data for the icon 
- * @mask: (allow-none): the transparency mask for the icon or %NULL for none.
- * @hot_x: the X offset within @pixmap of the hotspot.
- * @hot_y: the Y offset within @pixmap of the hotspot.
- * 
- * Sets @pixmap as the icon for a given drag. GTK+ retains
- * references for the arguments, and will release them when
- * they are no longer needed. In general, gtk_drag_set_icon_pixbuf()
- * will be more convenient to use.
- **/
-void 
-gtk_drag_set_icon_pixmap (GdkDragContext    *context,
-                         GdkColormap       *colormap,
-                         GdkPixmap         *pixmap,
-                         GdkBitmap         *mask,
-                         gint               hot_x,
-                         gint               hot_y)
-{
-  GtkWidget *window;
-  GdkScreen *screen;
-  gint width, height;
-      
-  g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
-  g_return_if_fail (context->is_source);
-  g_return_if_fail (GDK_IS_COLORMAP (colormap));
-  g_return_if_fail (GDK_IS_PIXMAP (pixmap));
-  g_return_if_fail (!mask || GDK_IS_PIXMAP (mask));
-
-  screen = gdk_colormap_get_screen (colormap);
-  
-  g_return_if_fail (gdk_drawable_get_screen (pixmap) == screen);
-  g_return_if_fail (!mask || gdk_drawable_get_screen (mask) == screen);
-  
-  gdk_drawable_get_size (pixmap, &width, &height);
-
-  gtk_widget_push_colormap (colormap);
-
-  window = gtk_window_new (GTK_WINDOW_POPUP);
-  gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND);
-  gtk_window_set_screen (GTK_WINDOW (window), screen);
-  set_can_change_screen (window, FALSE);
-  gtk_widget_set_events (window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
-  gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
-
-  gtk_widget_pop_colormap ();
-
-  gtk_widget_set_size_request (window, width, height);
-  gtk_widget_realize (window);
-
-  gdk_window_set_back_pixmap (gtk_widget_get_window (window),
-                              pixmap, FALSE);
-
-  if (mask)
-    {
-      cairo_region_t *region;
-      cairo_t *cr;
-
-      /* XXX: Clean this up properly */
-      cr = gdk_cairo_create (mask);
-      region = gdk_cairo_region_create_from_surface (cairo_get_target (cr));
-      cairo_destroy (cr);
-
-      gtk_widget_shape_combine_region (window, region);
-      cairo_region_destroy (region);
-    }
-
-  gtk_drag_set_icon_window (context, window, hot_x, hot_y, TRUE);
-}
-
 /* XXX: This function is in gdk, too. Should it be in Cairo? */
 static gboolean
 _gtk_cairo_surface_extents (cairo_surface_t *surface,
index 1bfc045f924dd44bf8969fa7535e99525eb6f525..bb2336df9b9169bc2fdbf757240b09847173058e 100644 (file)
@@ -115,10 +115,6 @@ void           gtk_drag_source_add_text_targets  (GtkWidget     *widget);
 void           gtk_drag_source_add_image_targets (GtkWidget    *widget);
 void           gtk_drag_source_add_uri_targets   (GtkWidget    *widget);
 
-void gtk_drag_source_set_icon         (GtkWidget       *widget,
-                                      GdkColormap     *colormap,
-                                      GdkPixmap       *pixmap,
-                                      GdkBitmap       *mask);
 void gtk_drag_source_set_icon_pixbuf  (GtkWidget       *widget,
                                       GdkPixbuf       *pixbuf);
 void gtk_drag_source_set_icon_stock   (GtkWidget       *widget,
@@ -142,12 +138,6 @@ void gtk_drag_set_icon_widget (GdkDragContext *context,
                               GtkWidget      *widget,
                               gint            hot_x,
                               gint            hot_y);
-void gtk_drag_set_icon_pixmap (GdkDragContext *context,
-                              GdkColormap    *colormap,
-                              GdkPixmap      *pixmap,
-                              GdkBitmap      *mask,
-                              gint            hot_x,
-                              gint            hot_y);
 void gtk_drag_set_icon_pixbuf (GdkDragContext *context,
                               GdkPixbuf      *pixbuf,
                               gint            hot_x,